/*
 * Copyright (c) 2018 Tencent. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
const AbstractModel = require("../../common/abstract_model");

/**
 * DescribeStrategies response structure.
 * @class
 */
class DescribeStrategiesResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * Assessment item list
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {Array.<Strategies> || null}
         */
        this.Strategies = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }

        if (params.Strategies) {
            this.Strategies = new Array();
            for (let z in params.Strategies) {
                let obj = new Strategies();
                obj.deserialize(params.Strategies[z]);
                this.Strategies.push(obj);
            }
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * DescribeTaskStrategyRisks request structure.
 * @class
 */
class DescribeTaskStrategyRisksRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Assessment item ID
         * @type {number || null}
         */
        this.StrategyId = null;

        /**
         * Quantity of returns. It is 100 by default, and the maximum value is 200.
         * @type {number || null}
         */
        this.Limit = null;

        /**
         * Offset, which is 0 by default.
         * @type {number || null}
         */
        this.Offset = null;

        /**
         * Environment
         * @type {string || null}
         */
        this.Env = null;

        /**
         * Task type
         * @type {string || null}
         */
        this.TaskType = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.StrategyId = 'StrategyId' in params ? params.StrategyId : null;
        this.Limit = 'Limit' in params ? params.Limit : null;
        this.Offset = 'Offset' in params ? params.Offset : null;
        this.Env = 'Env' in params ? params.Env : null;
        this.TaskType = 'TaskType' in params ? params.TaskType : null;

    }
}

/**
 * DescribeTaskStrategyRisks response structure.
 * @class
 */
class DescribeTaskStrategyRisksResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * According to this configuration, match the corresponding fields of the risky instance list (Risks), for example:
{"Response":{"RequestId":"111","RiskFieldsDesc":[{"Field":"InstanceId","FieldName":"ID","FieldType":"string","FieldDict":{} },{"Field":"InstanceName","FieldName":"Name","FieldType":"string","FieldDict":{}},{"Field":"InstanceState","FieldName":"Status ","FieldType":"string","FieldDict":{"LAUNCH_FAILED":"Creation failed","PENDING":"Creating","REBOOTING":"Re- starting","RUNNING":"Running","SHUTDOWN":"Stop waiting to be terminated","STARTING":"Starting","STOPPED":"Shut down","STOPPING":"Shutting down"," TERMINATING":"Terminating"}},{"Field":"Zone","FieldName":"Available zone","FieldType":"string","FieldDict":{}},{"Field":" PrivateIPAddresses","FieldName":"Private IP addresses","FieldType":"stringSlice","FieldDict":{}},{"Field":"PublicIPAddresses","FieldName":"Public IP addresses","Field Type":"stringSlice","FieldDict":{}},{"Field":"Region","FieldName":"Region","FieldType":"string","FieldDict":{}},{" Field":"Tags","FieldName":"Tags","FieldType":"tags","FieldDict":{}}],"RiskTotalCount":3,"Risks":"[{\"InstanceId\" :\"ins-xxx1\",\"InstanceName\":\"xxx1\",\"InstanceState\":\"RUNNING\",\"PrivateIPAddresses\":[\"1.17.64.2\"],\ " PublicIPAddresses\":null,\"Region\":\"ap-shanghai\",\"Tags\":null,\"Zone\":\"ap-shanghai-2\"},{\"InstanceId\ ":\"ins-xxx2\",\"InstanceName\":\"xxx2\",\"InstanceState\":\"RUNNING\",\"PrivateIPAddresses\":[\"1.17.64.11\"], \"PublicIPAddresses\":null,\"Region\":\"ap-shanghai\",\"Tags\":null,\"Zone\":\"ap-shanghai-2\"}]"," StrategyId":9}}
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {Array.<RiskFieldsDesc> || null}
         */
        this.RiskFieldsDesc = null;

        /**
         * Assessment item ID
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.StrategyId = null;

        /**
         * Number of risky instances
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.RiskTotalCount = null;

        /**
         * Risky instance details list. Require json decode.
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.Risks = null;

        /**
         * Number of inspection resources
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.ResourceCount = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }

        if (params.RiskFieldsDesc) {
            this.RiskFieldsDesc = new Array();
            for (let z in params.RiskFieldsDesc) {
                let obj = new RiskFieldsDesc();
                obj.deserialize(params.RiskFieldsDesc[z]);
                this.RiskFieldsDesc.push(obj);
            }
        }
        this.StrategyId = 'StrategyId' in params ? params.StrategyId : null;
        this.RiskTotalCount = 'RiskTotalCount' in params ? params.RiskTotalCount : null;
        this.Risks = 'Risks' in params ? params.Risks : null;
        this.ResourceCount = 'ResourceCount' in params ? params.ResourceCount : null;
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * Key-value pair
 * @class
 */
class KeyValue extends  AbstractModel {
    constructor(){
        super();

        /**
         * Key name
         * @type {string || null}
         */
        this.Key = null;

        /**
         * Value corresponding to the key name
         * @type {string || null}
         */
        this.Value = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Key = 'Key' in params ? params.Key : null;
        this.Value = 'Value' in params ? params.Value : null;

    }
}

/**
 * Risky instance field description
 * @class
 */
class RiskFieldsDesc extends  AbstractModel {
    constructor(){
        super();

        /**
         * Field ID
         * @type {string || null}
         */
        this.Field = null;

        /**
         * Field name
         * @type {string || null}
         */
        this.FieldName = null;

        /**
         * Field type, 
string: String type, such as "aa"
int: Integer, for example, 111
stringSlice : String array type, such as ["a", "b"]
tags: Tag type, for example: [{"Key":"kkk","Value":"vvv"},{"Key":"kkk2","Value":"vvv2"}]
         * @type {string || null}
         */
        this.FieldType = null;

        /**
         * Dictionary corresponding to the field value
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {Array.<KeyValue> || null}
         */
        this.FieldDict = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Field = 'Field' in params ? params.Field : null;
        this.FieldName = 'FieldName' in params ? params.FieldName : null;
        this.FieldType = 'FieldType' in params ? params.FieldType : null;

        if (params.FieldDict) {
            this.FieldDict = new Array();
            for (let z in params.FieldDict) {
                let obj = new KeyValue();
                obj.deserialize(params.FieldDict[z]);
                this.FieldDict.push(obj);
            }
        }

    }
}

/**
 * Information about assessment items
 * @class
 */
class Strategies extends  AbstractModel {
    constructor(){
        super();

        /**
         * Assessment item ID
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.StrategyId = null;

        /**
         * Assessment item name
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.Name = null;

        /**
         * Assessment item description
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.Desc = null;

        /**
         * Product ID corresponding to the assessment item
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.Product = null;

        /**
         * Product name corresponding to the assessment item
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.ProductDesc = null;

        /**
         * Optimization suggestions for the assessment item
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.Repair = null;

        /**
         * Category ID of the assessment item 
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.GroupId = null;

        /**
         * Category name of the assessment item 
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.GroupName = null;

        /**
         * Risk list of the assessment item 
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {Array.<Conditions> || null}
         */
        this.Conditions = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.StrategyId = 'StrategyId' in params ? params.StrategyId : null;
        this.Name = 'Name' in params ? params.Name : null;
        this.Desc = 'Desc' in params ? params.Desc : null;
        this.Product = 'Product' in params ? params.Product : null;
        this.ProductDesc = 'ProductDesc' in params ? params.ProductDesc : null;
        this.Repair = 'Repair' in params ? params.Repair : null;
        this.GroupId = 'GroupId' in params ? params.GroupId : null;
        this.GroupName = 'GroupName' in params ? params.GroupName : null;

        if (params.Conditions) {
            this.Conditions = new Array();
            for (let z in params.Conditions) {
                let obj = new Conditions();
                obj.deserialize(params.Conditions[z]);
                this.Conditions.push(obj);
            }
        }

    }
}

/**
 * Warning conditions of the assessment item
 * @class
 */
class Conditions extends  AbstractModel {
    constructor(){
        super();

        /**
         * Warning condition ID
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.ConditionId = null;

        /**
         * Warning level. 2: medium risk; 3: high risk.
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.Level = null;

        /**
         * Warning level description
Note: This field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.LevelDesc = null;

        /**
         * Warning condition description
         * @type {string || null}
         */
        this.Desc = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.ConditionId = 'ConditionId' in params ? params.ConditionId : null;
        this.Level = 'Level' in params ? params.Level : null;
        this.LevelDesc = 'LevelDesc' in params ? params.LevelDesc : null;
        this.Desc = 'Desc' in params ? params.Desc : null;

    }
}

/**
 * DescribeStrategies request structure.
 * @class
 */
class DescribeStrategiesRequest extends  AbstractModel {
    constructor(){
        super();

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }

    }
}

module.exports = {
    DescribeStrategiesResponse: DescribeStrategiesResponse,
    DescribeTaskStrategyRisksRequest: DescribeTaskStrategyRisksRequest,
    DescribeTaskStrategyRisksResponse: DescribeTaskStrategyRisksResponse,
    KeyValue: KeyValue,
    RiskFieldsDesc: RiskFieldsDesc,
    Strategies: Strategies,
    Conditions: Conditions,
    DescribeStrategiesRequest: DescribeStrategiesRequest,

}
